import { useEffect } from 'react'
import { UseCounter } from '@/lib/hooks/useCounter'

export function Timing(){

    const useCounter = UseCounter(100)
    //每次渲染都会执行
    useEffect( () => console.log("useEffect"))

    //只首次执行
    useEffect( () => {
        console.log("useEffect: ",document.getElementById('p'))
        console.log('只执行一次')
    },[])
    console.log("log: ",document.getElementById('p'))
    return (
        <div>
            <p id={'p'}>{ useCounter.counter }</p>
            <button onClick={ useCounter.increment }>click</button>
        </div>
    )
}
